package com.zmn.plat.manager.dictionary;

import com.zmn.common.dictionary.DictModel;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

/**
 * 文章字典
 * @author nowind
 * @since 17/07/08 18:07
 */
public class NewsDict {

    public final static int SHOWTYPE_ALL                    = 1;        //显示类型，全部
    public final static int SHOWTYPE_WEB                    = 2;        //显示类型，web
    public final static int SHOWTYPE_MOBILE                 = 3;        //显示类型，移动


    //region 显示类型
    public static String getShowType(int key) {

        switch (key) {
            case 1: return "全部显示";
            case 2: return "Web显示";
            case 3: return "移动显示";
            default: return "";
        }
    }

    public static List<DictModel> getShowTypeList() {

        List<DictModel> items = new ArrayList<>();
        items.add(new DictModel(1, "全部显示"));
        items.add(new DictModel(2, "Web显示"));
        items.add(new DictModel(3, "移动显示"));
        return items;
    }
    //endregion



    //test
    public static void main(String[] args) {
        List<Integer> baseCategoryList = Arrays.asList(1,2,3,4,5,6,7,8,9,10,11,12,13,14);
        int pageSize = 20;
        int pageNum = 1;

        Integer from = (pageNum - 1) * pageSize;
        Integer to = pageNum * pageSize;
        if (from > baseCategoryList.size()) {
            System.out.println("error.........");
            return;
        }
        if (baseCategoryList.size() > to) {
            baseCategoryList = baseCategoryList.subList(from, to);
        } else {
            baseCategoryList = baseCategoryList.subList(from, baseCategoryList.size());
        }
        System.out.println(baseCategoryList);
//
//        String label = getShowType(2);
//        System.out.println(label);
    }

}
